<script type="text/javascript">
$(function(){
	var pg = App.log.esIndex.ui, pp = pg.params, gd = pg.find('.grid');
	$('#head>.backBtn').unbind().hide();

	gd.mac('grid', {
		cols : [{
			field: 'index', title: '索引', width: 240
		},{
			field: 'shards', title: '分片数量', width: 80
		},{
			field: 'indexing', title: '分片数量', width: 80
		},{
			field: 'docs', title: '文档数', width: 120
		},{
			field: 'opt', title: '操作', width: 120,
			render: function(r){
				var p = $('<div></div>');
				$('<span class="a"></span>').click(function(){
					mac.confirm(Msg.confirm.message, function(){
						$.post(App.ctx + '/es/index/truncate.do', {
							code: r.index
						}, function(rs){
							var ro = mac.eval(rs);
							if (ro.success) {
								gd.load();
							}
						});
					}, [ $(this).html() ]);
				}).append('清理').appendTo(p);
				p.append('&nbsp;');
				$('<span class="a"></span>').click(function(){
					mac.confirm(Msg.confirm.message, function(){
						$.post(App.ctx + '/es/index/drop.do', {
							code: r.index
						}, function(rs){
							var ro = mac.eval(rs);
							if (ro.success) {
								gd.load();
							}
						});
					}, [ $(this).html() ]);
				}).append('删除').appendTo(p);
				return p;
			}
		}],
		loader: {
			url: App.ctx + '/es/index/list.do',
			params: { pageNo: 1, pageSize: 10 },
			autoLoad: true
		},
		pagerLength: 10
	});
	
	function adjust(){
		var p = pg.parent();
		pg.height(p.height() - 16);
		gd.parent().height(pg.height() - 24).width(p.width());
		gd.adjust();
	}
	$(window).resize(adjust);
	adjust();
});
</script>
<div class="head">
	查找 ：<input type="text" name="key" />
</div>
<div class="body">
	<div class="grid"></div>
</div>